package com.jz.community.modulemine.presenter;

import com.jz.community.basecomm.bean.BaseResponseText;
import com.jz.community.basecomm.bean.LoginInfo;
import com.jz.community.basecomm.mvp.BaseLifeCyclePresent;
import com.jz.community.basecomm.net.rxandroid.OnLoadListener;
import com.jz.community.modulemine.model.MineModel;
import com.jz.community.modulemine.model.MineModelImp;
import com.jz.community.modulemine.ui.BindingPhoneView;

/**
 * Created by Admin on 2018/3/30 0030.
 */

public class BindingPhonePresenter extends BaseLifeCyclePresent<BindingPhoneView.View> implements BindingPhoneView.Presenter {

    private BindingPhoneView.View view;
    private MineModel mineModel;

    public BindingPhonePresenter(BindingPhoneView.View view) {
        this.view = view;
        this.mineModel = new MineModelImp(view.getContext());
    }

    @Override
    public void getSmsCode(String mobi, String type) {
        mineModel.getSmsCode(mobi, type, new OnLoadListener<LoginInfo>() {
            @Override
            public void onSuccess(LoginInfo responseText) {
                view.showSmsCode(responseText);
            }

            @Override
            public void onFail(String s,int code) {

            }
        });
    }


    @Override
    public void checkWifiRegister(String mobile) {
        mineModel.checkWifiRegister(mobile, new OnLoadListener<BaseResponseText>() {
            @Override
            public void onSuccess(BaseResponseText responseText) {
                view.showCheckWifiRegister(responseText);
            }

            @Override
            public void onFail(String s,int code) {

            }
        });
    }
}
